//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Overall configuration settings for Queries
	/// </summary>    
	public class QuerySettings : SerializableConfigurationSection
	{
		#region Constants
		/// <summary>
		/// Configuration key for query settings.
		/// </summary>
		public const string SectionName = "queryConfiguration";
		private const string commandsProperty = "commands";
		private const string parameterSetsProperty = "parameterSets";
		private const string queriesProperty = "queries";
		#endregion

		#region Properties
		/// <summary>
		/// Gets the collection of custom <see cref="ICustomCommand"/> objects for file commands.
		/// </summary>
		/// <value>
		/// The collection of custom <see cref="ICustomCommand"/> objects.
		/// </value>
		[ConfigurationProperty(commandsProperty, IsRequired = false)]
		public NameTypeConfigurationElementCollection<CustomCommandData, CustomCommandData> Commands
		{
			get { return (NameTypeConfigurationElementCollection<CustomCommandData, CustomCommandData>)base[commandsProperty]; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="IParameterSet"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="IParameterSet"/> objects.
		/// </value>
		[ConfigurationProperty(parameterSetsProperty, IsRequired = false)]
		public NameTypeConfigurationElementCollection<ParameterSetData, ParameterSetData> ParameterSets
		{
			get { return (NameTypeConfigurationElementCollection<ParameterSetData, ParameterSetData>)base[parameterSetsProperty]; }
		}

		/// <summary>
		/// Gets the collection of defined <see cref="IQuery"/> objects.
		/// </summary>
		/// <value>
		/// The collection of defined <see cref="IQuery"/> objects.
		/// </value>
		[ConfigurationProperty(queriesProperty, IsRequired = false)]
		public NameTypeConfigurationElementCollection<QueryDataBase, CustomQueryData> Queries
		{
			get { return (NameTypeConfigurationElementCollection<QueryDataBase, CustomQueryData>)base[queriesProperty]; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="QuerySettings"/> class.
		/// </summary>
		public QuerySettings()
		{
		}
		#endregion
	}
}